package com.interview.select;

import java.util.HashMap;
import java.util.Hashtable;

public class test {
    public static int getInfo(int i) throws Exception {
        try {
            return  i/10;
        } catch (Exception exception) {
            throw  new Exception("exception in a getInfo");
        } finally {
            System.out.println("finally");
        }
    }
    public static void main1(String[] args) {
        try {
            getInfo(0);
        } catch (Exception ex) {
            System.out.println("exception in main");
        }finally {
            System.out.println("finished");
        }
    }
    public int getValue(int i){
        int result =0;
        switch (i){
            case 1:
                result = result +i;
            case 2:
                result = result +i*2;
            case 3:
                result = result +i*3;
        }
        return result;
    }

    public static void main3(String[] args) {
//        System.out.println(aa());
        HashMap<Object, Object> HashMap = new HashMap<>();
        HashMap.put("森",null);
        HashMap.put("森","成长");
        System.out.println(HashMap.size());

        Hashtable<Object, Object> Hashtable = new Hashtable<>();
        Hashtable.put("森",null);
        Hashtable.put("森","null");
        System.out.println(HashMap.size()+""+Hashtable.size());
    }
    public static int aa(){
        int a =1;
        try{
            a --;
            return a;
        }finally {
            a = 2;
        }
    }

    public static void main4(String[] args) {
        StringBuffer a = new StringBuffer("A");
        StringBuffer b = new StringBuffer("B");
        operator(a,b);
    }
    public static void operator(StringBuffer x,StringBuffer y){
        x.append(y);
        y = x ;
        System.out.println(x+","+y);
    }

    private static int x = 100;

    public static void main(String[] args) {
        int sum = 0;
        for (int i = 0; i < 10; i++,sum +=i) {
        }
        System.out.println(sum);
    }
}
//class Nase{
//    protected  final  void getInfo{
//        System.out.println("method of Base class 森！！仔");
//    }
//}
